/**
 * Copyright (c) 2017 Guangzhou Ourchem Infomation Consulting Co., Ltd.
 */
package com.eddy.liveline.message.controller;

import com.eddy.liveline.core.web.controller.BaseController;
import com.eddy.liveline.message.pojo.Message;
import com.eddy.liveline.message.pojo.MessageTableQuery;
import com.eddy.liveline.message.service.MessageService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 *
 */
@Controller
@RequestMapping("/message")
public class MessageController extends BaseController {

	@Autowired
	MessageService messageService;


	@RequestMapping("/list")
	public String get(Model model, MessageTableQuery query) throws Exception{

		//就用来展示消息（需求，活动）
		PageInfo<Message> list = messageService.query(query);

		model.addAttribute("messages",list);

		return render_world("message_list");
	}


	@RequestMapping("/get/{id}")
	public String get(Model model, @PathVariable("id") String id) throws Exception{

		//就用来展示消息（需求，活动）
		Message messages = messageService.getById(id);

		model.addAttribute("messages",messages);

		return render_world("message_detail");
	}

	

}
